package cn.ichiva.puppet.example.base.p2;

import javafx.fxml.FXML;
import javafx.fxml.impl.AbstractPuppetComponent;
import javafx.scene.control.Button;

/**
 * 条件渲染,事件绑定
 */
public class L1RedButton extends AbstractPuppetComponent {

    @Override
    public CharSequence render() {
        imports(Button.class);
        return """
                <Button text="提交" style="-fx-background-color: red;" onAction="#commit" />
                """;
    }

    @FXML
    void commit(){
        System.out.println("红色按钮被点击了");
    }
}
